<%--
  Created by IntelliJ IDEA.
  User: imac
  Date: 2020/3/2
  Time: 11:48 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="https://code.jquery.com/jquery-latest.js"></script>
    <script>
        function getValue(element) {

            $.ajax({
                type:"get",
                url:"getajax",
                //<a href="/webdemomvc/user/mananger?id=1&q=list"></a>
                data:"action=getvalue",
                dataType:"json",
                async:true,
                success:function (data) {
                    //在页面中显示data中的数据
                    for(var i = 0;i<data.length;i++){
                        $(element).append("<option>"+data[i]+"</option>");
                    }
                }
            });
        }
    </script>
</head>
<body>
<div>
    <select id="select1" onfocus="getValue(this)">

        <option value="1">点击取值</option>
    </select>
</div>
</body>
</html>